{% extends '后台/layout.html' %}


{% load static %}

{% block title %}

{% endblock %}

{% block css %}

{% endblock %}

{% block content %}
<div class="card">
    <div class="card-body">
        <h5 class="card-title">新增一期</h5>

        <!-- <div class="mb-3 row" style="margin:10px 0;">
            <label for="inputPassword" class="col-sm-2 col-form-label">用户账号</label>
            <div class="col-sm-10">
                <input type="text" class="form-control" id="inputText">
            </div>
        </div> -->
        <form method="post">
            {% csrf_token %}
        
            {% if is_show == 0 %}
            <!-- 新增 -->
            <div class="mb-3 row" style="margin:10px 0;">
                <label for="inputPassword" class="col-sm-2 col-form-label">开奖时间</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" id="inputText" name="open_time"
                        placeholder="请按照此格式进行填写：2023-01-21">
                    <small style="color: red;">{{obj.errors.0}}</small>
                </div>
            </div>

            <div class="mb-3 row" style="margin:10px 0;">
                <label for="inputPassword" class="col-sm-2 col-form-label">开奖生肖</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" name="open_shengxiao" value="['龙', '牛', '鸡', '羊', '蛇']"
                        placeholder="请按照此格式进行填写(5个): ['龙', '牛', '鸡', '羊', '蛇']">
                    <small style="color: red;">{{obj.errors.0}}</small>
                </div>
            </div>
            <script>
                var date = new Date();
                var time = date.toJSON().split('T').join(' ').substr(0, 10);
                document.querySelector("#inputText").value = time;
            </script>
            {% else %}

            <!-- 编辑 -->

            <div class="mb-3 row" style="margin:10px 0;">
                <label for="inputPassword" class="col-sm-2 col-form-label">开奖时间</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" value="{{data.open_time | date:'Y-m-d'}}" id="inputText" name="open_time"
                        placeholder="请按照此格式进行填写：2023-01-21">
                    <small style="color: red;">{{obj.errors.0}}</small>
                </div>
            </div>

            <div class="mb-3 row" style="margin:10px 0;">
                <label for="inputPassword" class="col-sm-2 col-form-label">开奖生肖</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" name="open_shengxiao" value="{{data.open_shengxiao}}"
                        placeholder="请按照此格式进行填写(5个): ['龙', '牛', '鸡', '羊', '蛇']">
                    <small style="color: red;">{{obj.errors.0}}</small>
                </div>
            </div>




            {% endif %}

            <div class="mb-3 row" style="margin:10px 0;">
                <label for="inputPassword" class="col-sm-2 col-form-label"></label>
                <div class="col-sm-10">
                    <!-- <input type="text" class="form-control" id="inputText"> -->
                    <button type="submit" class="btn btn-primary btn-lg">确定修改</button>
                </div>
            </div>

        </form>


    </div>
</div>
{% endblock %}

{% block js %}

{% endblock %}